package week4.num.ExceptionDemo01.utilityTest;

import java.util.Scanner;

public class ToThree {
    public static void main(String[] args) {
        //创建键盘录入的对象
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入一个字符串");
        /**
         * 创建字符串变量接收键盘录入数据
         */
        String str=sc.nextLine();
        //将字符串转化为字符数组并创建字符数组接收
        char[] charArray = str.toCharArray();
        //遍历字符数组并按要求改变其内容
        for (int i = 0; i < charArray.length; i++) {
            charArray[i]=(char) (charArray[i]+3);
        }
        //创建stringBuilder对象
        StringBuilder sb=new StringBuilder();
        //遍历字符数组并利用循环拼接到sb中
        for (int i = 0; i < charArray.length; i++) {
            sb.append(charArray[i]);
        }
        //将sb转化为字符串形式并创建字符串变量接收
        String string = sb.toString();
        //打印结果
        System.out.println(string);
    }
}
